pub fn encode(plaintext: &str) -> String {
    plaintext
        .chars()
        .filter_map(swap)
        .collect::<Vec<_>>()
        .chunks(5)
        .collect::<Vec<_>>()
        .join(&' ')
        .iter()
        .collect()
}
pub fn decode(ciphertext: &str) -> String {
    ciphertext
        .chars()
        .filter_map(swap)
        .collect()
}
fn swap(c: char) -> Option<char> {
    match c {
        '0'..='9' => Some(c),
        'a'..='z' => Some((b'a' + b'z' - c as u8) as char),
        'A'..='Z' => Some((b'a' + b'Z' - c as u8) as char),
        _ => None
    }
}

#[test]
#[ignore]
fn encode_deep_thought() {
    assert_eq!(crate::atbash_cipher::encode("Truth is fiction."), "gifgs rhurx grlm");
}